<template>
  <div>
    <div class="header">
      <header class="navbar">
        <!-- 左侧导航栏 -->
        <div class="navbar-left">
          <div class="navbar-logo" @click="logoClickEvent">
            <img src="@/assets/images/logo.png" alt="LOGO">
          </div>
          <div class="navbar-title">
            <span>
              <h1>委 托 发 布</h1>
            </span>
          </div>
        </div>
        <!-- 右侧用户头像 -->
        <div class="navbar-right">
          <el-avatar :size="40" :src="circleUrl" />
        </div>

      </header>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref, reactive, toRefs } from "vue"
import { useRoute, useRouter } from 'vue-router'

const route = useRoute()
const router = useRouter()

// 导航栏动态渲染 =========================
const activeIndex = ref('1')

// 头像
const state = reactive({
  circleUrl:
    'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
})
const { circleUrl } = toRefs(state)

// Logo点击事件
const logoClickEvent = () => {
  console.log('跳转到index')
  router.push({
    name: 'Index',
  })
}

</script>

<style lang="less" scoped>
@border-color: #dcdfe6; //边框默认颜色

.header {
  width: 100%;
  background-color: #ffffff;

  .navbar {
    display: flex;
    justify-content: space-between;
    height: 60px;
    border-bottom: 2px solid @border-color;

    .navbar-left {
      flex: 1;

      display: flex;
      align-items: center;

      .navbar-logo {
        height: 100%;
        border: 2px solid @border-color;
        border-bottom: none;
        margin-right: 40px;

        display: flex;
        align-items: center;

        img {
          width: 179px;
          vertical-align: middle;

        }
      }

      .navbar-title {
        span {
          h1 {
            font-size: 30px;
          }
        }
      }
    }

    .navbar-right {
      display: flex;
      flex-direction: row-reverse;
      justify-content: space-around;
      align-items: center;
      width: 200px;
    }
  }
}
</style>